import React, { useEffect, useState } from 'react'
import { useMountedState } from 'react-use'
export default function App() {
    const isMounted = useMountedState()
    const [num,setNum] = useState(0)
    useEffect(() => {
        setTimeout(() => {
            setNum(1)
            console.log(num)
        }, 2000);
    }, [])
    return (
        <div>
            {isMounted() ? 'mounted' : 'pending'}
            <div>{num}</div>
        </div>
    )
}
